package com.example.mapper;

import com.example.model.UserInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: bjc
 * Date: 2025-07-11
 * Time: 17:18
 */
@Mapper
public interface UserInfoMapper {


    /*
    传入参数类型是 Integer 时占位符#{}和拼接符${}的区别
     */
    @Select("select * from user_info where delete_flag = #{deleteflag}")
    List<UserInfo> getUserInfoByDeleteFlag(Integer deleteflag);

    @Select("select * from user_info where delete_flag = ${deleteflag}")
    List<UserInfo> getUserInfoByDeleteFlag1(Integer deleteflag);

    /*
    传入参数类型是 String 时占位符#{}和拼接符${}的区别
     */
    @Select("select * from user_info where username = #{username}")
    List<UserInfo> getUserInfoByUserName(String username);

    /*@Select("select * from user_info where username = ${username}")
    List<UserInfo> getUserInfoByUserName1(String username);*/
    //使用拼接符的时候，传入类型是字符串时，需要使用引号
    @Select("select * from user_info where username = '${username}'")
    List<UserInfo> getUserInfoByUserName1(String username);

}
